<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<title>流程设置</title>
		<link rel="stylesheet" href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
iframe {
width: 100%; height: 600px;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<h:form>
				<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
				<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
			</h:form>
		</p:confirmDialog>
		<div class='full-center-content-scroll-noheader'>
			<div class="tab-content no-padding">
				<div class="chart tab-pane active" id="accountInfo" style="position: relative">
					<div class="row">
						<div class="col-md-3 full-content">
							<div class="box box-primary">
								<div class="box-header with-border">
									<h:form id="definitionButtonForm">
										<p:growl id="msg" showDetail="true" />
										<p:toolbar id="toolbar">
											<f:facet name="left">
												<p:commandButton id="createDefinitionBtn" value="新增"
													actionListener="#{processItemConfigController.preCreatDefinition}"
													oncomplete="PF('createDefinitionDlg').show()"
													update="createDefinitionForm:createDefinitionDetail" 
													rendered="#{s:hasPermission(session,'xtsz_gzjgjgc_xzlc')}"/>
												<p:commandButton id="editDefinitionBtn" value="编辑"
													oncomplete="PF('editDefinitionDlg').show()"
													update="editDefinitionForm:editDefinitionDetail"
													disabled="#{processItemConfigController.currentSelect == null}" 
													rendered="#{s:hasPermission(session,'xtsz_gzjgjgc_bjlc')}"/>
												<p:commandButton id="deleteDefinitionBtn" value="删除"
													update="treeForm:tree dataForm:datatable msg toolbar "
													actionListener="#{processItemConfigController.deleteDefinition}"
													disabled="#{processItemConfigController.currentSelect == null}"
													rendered="#{s:hasPermission(session,'xtsz_gzjgjgc_sclc')}">
													<p:confirm header="提示" message="确定要删除么？" icon="ui-icon-alert" />
												</p:commandButton>
											</f:facet>
										</p:toolbar>
									</h:form>
								</div>
								<div class="box-body  full-content-scroll">
									<h:form id="treeForm">
										<p:tree id="tree" widgetVar="tree" value="#{processItemConfigController.root}"
											style="width:400px;border:none" selectionMode="single" var="node" dynamic="true"
											animate="true" selection="#{processItemConfigController.currentSelect}">
											<p:ajax event="select" process="@this"
												update="dataForm dataButtonForm:toolbar definitionButtonForm:toolbar"
												listener="#{processItemConfigController.onNodeSelect}" />
											<p:treeNode type="root" icon="fa fa-cogs">
												<h:outputText value="#{node}" />
											</p:treeNode>
										</p:tree>
									</h:form>
									<p:dialog widgetVar="createDefinitionDlg" header="新增" modal="true" id="createDefinitionDlg"
										width="350" height="160">
										<h:form id="createDefinitionForm">
											<p:toolbar>
												<f:facet name="left">
													<p:commandButton id="createDefinitionSaveBtn" value="保存"
														actionListener="#{processItemConfigController.saveNewDefinition}"
														update="treeForm:tree definitionButtonForm:toolbar definitionButtonForm:msg"
														oncomplete="PF('createDefinitionDlg').hide()" con="fa fa-floppy-o" />
												</f:facet>
											</p:toolbar>
											<p:outputPanel id="createDefinitionDetail" style="text-align:center;width:100%;">
												<p:panelGrid columns="2" style="width:100%;">
													<h:outputText value="名称" />
													<p:inputText value="#{processItemConfigController.createDefinition.name}"
														style="width:100%;" />
													<h:outputText value="状态" />
													<p:inputText value="#{processItemConfigController.createDefinition.status}"
														style="width:100%;" />
													<h:outputText value="版本" />
													<p:inputText value="#{processItemConfigController.createDefinition.version}"
														style="width:100%;" />
												</p:panelGrid>
											</p:outputPanel>
										</h:form>
									</p:dialog>
									<p:dialog id="editDefinitionDlg" widgetVar="editDefinitionDlg" header="编辑" modal="true"
										width="350" height="160">
										<h:form id="editDefinitionForm">
											<p:toolbar>
												<f:facet name="left">
													<p:commandButton id="editDefinitionSaveBtn" value="保存"
														actionListener="#{processItemConfigController.saveEditDefinition}"
														update="treeForm:tree definitionButtonForm:toolbar definitionButtonForm:msg"
														oncomplete="PF('editDefinitionDlg').hide()" con="fa fa-floppy-o" />
												</f:facet>
											</p:toolbar>
											<p:outputPanel id="editDefinitionDetail" style="text-align:center;width:100%;">
												<p:panelGrid columns="2" style="width:100%;">
													<h:outputText value="名称" />
													<p:inputText value="#{processItemConfigController.selectDefinition.name}"
														style="width:100%;" />
													<h:outputText value="状态" />
													<p:inputText value="#{processItemConfigController.createDefinition.status}"
														style="width:100%;" />
													<h:outputText value="版本" />
													<p:inputText value="#{processItemConfigController.createDefinition.version}"
														style="width:100%;" />
												</p:panelGrid>
											</p:outputPanel>
										</h:form>
									</p:dialog>
								</div>
								<div class="box-footer"></div>
							</div>
						</div>
						<div class="col-md-9 full-content">
							<div class="box box-primary">
								<div class="box-header with-border">
									<h:form id="dataButtonForm">
										<p:toolbar id="toolbar">
											<f:facet name="left">
												<p:commandButton id="createButton" value="新增" oncomplete="PF('createDialog').show()"
													actionListener="#{processItemConfigController.preCreateItem}"
													update="createItemForm:createDetail"
													disabled="#{processItemConfigController.currentSelect == null}" 
													rendered="#{s:hasPermission(session,'xtsz_gzjgjgc_xzlcjd')}"/>
												<p:commandButton id="editButton" value="编辑" oncomplete="PF('editDialog').show()"
													update="editItemForm"
													disabled="#{processItemConfigController.currentSelect == null or processItemConfigController.selected == null}" 
													rendered="#{s:hasPermission(session,'xtsz_gzjgjgc_bjlcjd')}"/>
												<p:commandButton id="deleteButton" value="删除"
													update="dataForm:datatable definitionButtonForm:msg toolbar"
													actionListener="#{processItemConfigController.deleteItem}"
													disabled="#{processItemConfigController.currentSelect == null or processItemConfigController.selected == null}"
													rendered="#{s:hasPermission(session,'xtsz_gzjgjgc_sclcjd')}">
													<p:confirm header="提示" message="确定要删除么？" icon="ui-icon-alert" />
												</p:commandButton>
											</f:facet>
										</p:toolbar>
									</h:form>
								</div>
								<div class="box-body full-content-scroll ">
									<h:form id="dataForm">
										<p:growl id="msg" showDetail="true" />
										<p:dataTable id="datatable" var="pitem"
											value="#{processItemConfigController.processItems}" rowKey="#{pitem.id}"
											rowIndexVar="ite" selection="#{processItemConfigController.selected}"
											selectionMode="single" emptyMessage="无数据" draggableRows="true">
											<p:ajax event="rowReorder" listener="#{processItemConfigController.onRowReorder}"
												update="dataForm:msg dataForm:datatable" />
											<p:ajax event="rowSelect" listener="#{processItemConfigController.onRowSelect}"
												update="dataButtonForm:toolbar" />
											<p:column headerText="序号 " style="width:60px;text-align:center">
												<h:outputText value="#{ite+1}" />
											</p:column>
											<p:column headerText="名称" style="width:10%;">
												<h:outputText value="#{pitem.name}" />
											</p:column>
											<p:column headerText="处理类" style="width:40%;">
												<h:outputText value="#{pitem.handlerClass}" />
											</p:column>
											<p:column headerText="状态" style="width:10%;">
												<h:outputText value="#{pitem.status}" />
											</p:column>
											<p:column headerText="排序" style="width:10%;">
												<h:outputText value="#{pitem.orderNo}" />
											</p:column>
										</p:dataTable>
									</h:form>
									<p:dialog id="createDialog" widgetVar="createDialog" header="新增" modal="true" width="600"
										height="200">
										<h:form id="createItemForm">
											<p:toolbar id="toolbar">
												<f:facet name="left">
													<p:commandButton id="createSaveBtn" value="保存"
														actionListener="#{processItemConfigController.saveNewItem}"
														update="dataForm:datatable dataButtonForm:toolbar definitionButtonForm:msg"
														oncomplete="PF('createDialog').hide()" con="fa fa-floppy-o" />
												</f:facet>
											</p:toolbar>
											<p:outputPanel id="createDetail" style="text-align:center;width:100%;">
												<p:panelGrid columns="2" style="width:100%;">
													<h:outputText value="名称" />
													<p:inputText value="#{processItemConfigController.createItem.name}" style="width:100%;" />
													<h:outputText value="处理类（包名.文件名）" />
													<p:inputText value="#{processItemConfigController.createItem.handlerClass}"
														style="width:100%;" />
													<h:outputText value="状态" />
													<p:inputText value="#{processItemConfigController.createItem.status}"
														style="width:100%;" />
													<h:outputText value="排序" />
													<p:inputText value="#{processItemConfigController.createItem.orderNo}"
														style="width:100%;" />
												</p:panelGrid>
											</p:outputPanel>
										</h:form>
									</p:dialog>
									<p:dialog id="editDialog" widgetVar="editDialog" header="编辑" modal="true" width="600"
										height="200">
										<h:form id="editItemForm">
											<p:toolbar id="toolbar">
												<f:facet name="left">
													<p:commandButton id="createSaveBtn" value="保存"
														actionListener="#{processItemConfigController.saveEditItem()}"
														update="dataForm:datatable dataButtonForm:toolbar definitionButtonForm:msg"
														oncomplete="PF('editDialog').hide()" con="fa fa-floppy-o" />
												</f:facet>
											</p:toolbar>
											<p:outputPanel id="createDetail" style="text-align:center;width:100%;">
												<p:panelGrid columns="2" style="width:100%;">
													<h:outputText value="名称" />
													<p:inputText value="#{processItemConfigController.selected.name}" style="width:100%;" />
													<h:outputText value="处理类（包名.文件名）" />
													<p:inputText value="#{processItemConfigController.selected.handlerClass}"
														style="width:100%;" />
													<h:outputText value="状态" />
													<p:inputText value="#{processItemConfigController.selected.status}" style="width:100%;" />
													<h:outputText value="排序" />
													<p:inputText value="#{processItemConfigController.selected.orderNo}"
														style="width:100%;" />
												</p:panelGrid>
											</p:outputPanel>
										</h:form>
									</p:dialog>
								</div>
								<div class="box-footer"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</ui:define>
	<ui:define name="contentend">
	</ui:define>
</ui:composition>
